home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / upsd / ups_folder / patch02.old < prev    next >
Encoding:
Internet Message Format  |  1991-05-01  |  4.9 KB

  1. From: art@pilikia.pegasus.com (Authur W. Neilson III)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i015:  upsd - UPS monitor daemon, Patch02
  4. Message-ID: <1991Apr12.034835.4780@sparky.IMD.Sterling.COM>
  5. Date: 12 Apr 91 03:48:35 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: 3a78d849 08f863c5 12d9372d 306147ce
  8.  
  9. Submitted-by: Authur W. Neilson III  <art@pilikia.pegasus.com>
  10. Posting-number: Volume 18, Issue 15
  11. Archive-name: upsd/patch02
  12. Patch-To: upsd: Volume 18, Issue 5
  13.  
  14. This is an update to the UPS monitor daemon.  This patch adds logfile
  15. locking and allows only 1 upsd to be running at a time.  Other minor
  16. cleanups were also done.  Unshar this patch then apply this set
  17. of context diffs to upsd patchlevel 1 via Larry Wall's "patch" utility
  18. like this:
  19.          patch < Patch02
  20. Art
  21. -----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
  22. #! /bin/sh
  23. # This is a shell archive.  Remove anything before this line, then feed it
  24. # into a shell via "sh file" or similar.  To overwrite existing files,
  25. # type "sh file -c".
  26. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  27. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  28. # Contents:  Patch02
  29. # Wrapped by kent@sparky on Thu Apr 11 22:42:00 1991
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. echo If this archive is complete, you will see the following message:
  32. echo '          "shar: End of archive."'
  33. if test -f 'Patch02' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'Patch02'\"
  35. else
  36.   echo shar: Extracting \"'Patch02'\" \(2727 characters\)
  37.   sed "s/^X//" >'Patch02' <<'END_OF_FILE'
  38. X*** HISTORY.orig    Thu Apr 11 08:11:34 1991
  39. X--- HISTORY    Thu Apr 11 08:15:12 1991
  40. X***************
  41. X*** 1,7 ****
  42. X! RELEASE HISTORY
  43. X  
  44. X  Date      Release  Patch  Description
  45. X  -------------------------------------------------------------------------------
  46. X! 03/30/91  1.0      0      Initial release to net
  47. X  04/09/91  1.0      1      Fixed stupidity with ups_time alarm setting and
  48. X!                           added version stuff
  49. X--- 1,9 ----
  50. X! UPSD RELEASE HISTORY    art@pilikia.pegasus.com
  51. X  
  52. X  Date      Release  Patch  Description
  53. X  -------------------------------------------------------------------------------
  54. X! 03/30/91  1.0      0      Initial release to net.
  55. X  04/09/91  1.0      1      Fixed stupidity with ups_time alarm setting and
  56. X!                           added version stuff.
  57. X! 04/10/91  1.0      2      Added log file locking, only 1 upsd can be running
  58. X!                           now.  Also added date to version string.
  59. X*** common.h.orig    Thu Apr 11 08:11:34 1991
  60. X--- common.h    Thu Apr 11 08:15:12 1991
  61. X***************
  62. X*** 12,17 ****
  63. X--- 12,18 ----
  64. X  #include <string.h>
  65. X  #include <fcntl.h>
  66. X  #include <time.h>
  67. X+ #include <unistd.h>
  68. X  #include <sys/types.h>
  69. X  #include <sys/termio.h>
  70. X  #include <sys/signal.h>
  71. X*** funcs.c.orig    Thu Apr 11 08:11:35 1991
  72. X--- funcs.c    Thu Apr 11 08:15:12 1991
  73. X***************
  74. X*** 153,158 ****
  75. X--- 153,162 ----
  76. X          if ((log_fd = open(ups_log, LOG_FLAGS, LOG_PERMS)) == ERR)
  77. X              exit(1);
  78. X  
  79. X+         /* and advisory lock it */
  80. X+         if (lockf(log_fd, F_TLOCK, 0L) == ERR)
  81. X+             exit(1);
  82. X+ 
  83. X          writelog(START_MSG);
  84. X  
  85. X          /* open blocks on UPS switch to battery */
  86. X***************
  87. X*** 292,301 ****
  88. X  {
  89. X      char   *basename();
  90. X  
  91. X!     /* display version if foreground */
  92. X      if (signal(SIGINT, SIG_IGN) != SIG_IGN)
  93. X!         fprintf(stderr, "%s v%d.%d patchlevel %d\n", basename(s),
  94. X!             RELEASE, REVISION, PATCHLEVEL);
  95. X  }
  96. X  
  97. X  /*
  98. X--- 296,306 ----
  99. X  {
  100. X      char   *basename();
  101. X  
  102. X!     /* display version in foreground */
  103. X      if (signal(SIGINT, SIG_IGN) != SIG_IGN)
  104. X!         fprintf(stderr, "%s release %s version %d.%d patchlevel %d\n",
  105. X!             basename(s), RELEASE_DATE, RELEASE, REVISION,
  106. X!             PATCHLEVEL);
  107. X  }
  108. X  
  109. X  /*
  110. X*** ups.orig    Thu Apr 11 08:11:35 1991
  111. X--- ups    Thu Apr 11 08:15:12 1991
  112. X***************
  113. X*** 10,14 ****
  114. X  set `who -r`
  115. X  if [ $9 = "S" -a -x /etc/upsd ]
  116. X  then
  117. X!     /etc/upsd
  118. X  fi
  119. X--- 10,14 ----
  120. X  set `who -r`
  121. X  if [ $9 = "S" -a -x /etc/upsd ]
  122. X  then
  123. X!     /etc/upsd &
  124. X  fi
  125. X*** version.h.orig    Thu Apr 11 08:11:35 1991
  126. X--- version.h    Thu Apr 11 08:15:12 1991
  127. X***************
  128. X*** 11,14 ****
  129. X  #define RELEASE_DATE    "03/30/91"
  130. X  #define RELEASE        1
  131. X  #define REVISION    0
  132. X! #define PATCHLEVEL    1
  133. X--- 11,14 ----
  134. X  #define RELEASE_DATE    "03/30/91"
  135. X  #define RELEASE        1
  136. X  #define REVISION    0
  137. X! #define PATCHLEVEL    2
  138. END_OF_FILE
  139.   if test 2727 -ne `wc -c <'Patch02'`; then
  140.     echo shar: \"'Patch02'\" unpacked with wrong size!
  141.   fi
  142.   # end of 'Patch02'
  143. fi
  144. echo shar: End of archive.
  145. exit 0
  146. ----
  147. Arthur W. Neilson III        | INET: art@pilikia.pegasus.com
  148. Bank of Hawaii Tech Support    | UUCP: uunet!ucsd!nosc!pilikia!art
  149.  
  150. exit 0 # Just in case...
  151. -- 
  152. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  153. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  154. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  155. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  156.